<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>getElementsByName和getElementsByTagName</title>
</head>
<body>
    <div id="app">
        <div name="hd"></div>
        <div></div>
        <input type="text" name="hdms">
    </div>
    <script>
        // 只能用于document
        console.log(document.getElementsByName('hd'));
        // 可以用于其他节点，不限于document
        console.log(document.getElementById('app').getElementsByTagName('div'));

        // 可以使用通配符查找所有的标签
        console.log(document.getElementById('app').getElementsByTagName('*'));
    </script>
</body>
</html>